
//C'est un Immutable
public class Board {
	public int[][] board;

	public Board(){
		this.board = new int[8][8];
	}
	
	public Board(int[][] board){
		this.board = new int[8][8];
		for(int i=0; i < 8; i++)
			for(int j=0; j < 8; j++)
				this.board[i][j] = board[i][j];
	}
	
	public void print(){
		for(int j = 7; j >= 0; j--){
			for(int i = 0; i < 8; i++)
				System.out.print(board[i][j]);
			System.out.println("");
		}
	}
	
	public Board applyMove(Move m){
		Board newBoard = new Board(board);
		
		//Apply move
		int pawnToMove = board[m.getOrigin().x][m.getOrigin().y];
		newBoard.board[m.getDest().x][m.getDest().y] =  pawnToMove;
		newBoard.board[m.getOrigin().x][m.getOrigin().y] = 0;
		
		//Return new board
		return newBoard;
	}
}
